<template>
	<view class="helpHimOut">
		<view class="box1">
			<view class="box2">
				<view class="c3d f28">
					您的好友正在参与砍价
				</view>
				<view class="f36 fb mt20 error">
					助力成功！
				</view>
				<view class="kjjd mt38">
					<view class="flex_jc">
						<image v-for="(item,index) in imgList" class="imgxl" :src="item" mode=""></image>
					</view>
					<view class="mt20 c3d f28 tac">
						好友砍价进度（ <text class="warning">{{helpData.help_user_number || 0}}</text> /3）
					</view>
				</view>
				<view class="btzl" v-if="helpData.is_help" @click="btzl">
					帮TA助力
				</view>
				<view class="jrhssj" @click="goIndex" v-else>
					进入好饰乐居
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ids: [],
				helpData: {},
				imgList: [
					'https://img.aibbyp.com/wechatUser/xiaolian.png',
					'https://img.aibbyp.com/wechatUser/xiaolian.png',
					'https://img.aibbyp.com/wechatUser/xiaolian.png',
				],
			}
		},

		onLoad() {
			if (uni.getStorageSync('assist')) {
				this.ids = uni.getStorageSync('assist')
				this.getfriendHelpDetail()
				uni.removeStorage({
					key: 'assist'
				})
			}else{
				uni.navigateBack({delta:1})
			}
		},
		methods: {
			btzl() {
				this.$api.post({
					url: '/wanlshop/order/help',
					data: {
						ids: this.ids
					},
				}).then(res => {
					uni.showToast({
						title: '助力成功'
					})
					this.helpData.is_help = false
					this.getfriendHelpDetail()
				})
			},
			getfriendHelpDetail() {
				this.$api.post({
					url: '/wanlshop/order/friendHelpDetail',
					data: {
						ids: this.ids
					},
					success: res => {
						this.helpData = res
						for (var i = 0; i < Number(res.help_user_number); i++) {
							this.imgList[i] = 'https://img.aibbyp.com/wechatUser/xiaolianchenggong.png'
						}
					},
					fail: error => {}
				})
			},
			goIndex() {
				uni.reLaunch({
					url: '/pages/tabbarcompotant/index/landlord'
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.helpHimOut {
		padding: 314rpx 20rpx 20rpx;
		height: 100vh;
		width: 100%;
		background-image: url('https://img.aibbyp.com/wechatUser/zhulibeijin.png');
		background-size: 100% 600rpx;
		background-repeat: no-repeat;

		.jrhssj {
			margin-top: 88rpx;
			font-size: 36rpx;
			color: #FF6400;
			font-weight: bold;
			padding: 26rpx 186rpx;
			border-radius: 80rpx 80rpx 80rpx 80rpx;
			border: 2rpx solid #FF6400;
		}

		.btzl {
			font-size: 36rpx;
			color: #FFFFFF;
			font-weight: bold;
			margin-top: 88rpx;
			padding: 26rpx 216rpx;
			background: linear-gradient(270deg, #FF7319 0%, #FF8F47 49%, #FF6400 100%);
			box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.1);
			border-radius: 80rpx 80rpx 80rpx 80rpx;
		}

		.box1 {
			background: rgba(255, 255, 255, 0.5);
			padding: 14rpx;
			border-radius: 16rpx 16rpx 16rpx 16rpx;

			.box2 {
				background: #fff;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding: 44rpx 0;

				.kjjd {
					background: #F8F8F8;
					border-radius: 20rpx 20rpx 20rpx 20rpx;
					padding: 38rpx 0 30rpx;
					width: 520rpx;

					.imgxl {
						width: 80rpx;
						height: 80rpx;
						margin: 0 26rpx;
					}
				}
			}
		}
	}
</style>